package com.lxd.api.utils;

import com.lxd.api.vo.ResultVo;
import com.lxd.common.exception.ApiException;

/**
 * @Author Dongdong
 * @注释
 */

public class R {
    /**
     * 成功返回
     * @return
     */
    public static ResultVo ok(){
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(0);
        resultVo.setMsg("接收成功");

        return resultVo;
    }
    public  static ResultVo error(Integer code,String msg){
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(code);
        resultVo.setMsg(msg);

        return resultVo;
    }
    public static ResultVo error(ApiException e){
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(e.getCode());
        resultVo.setMsg(e.getMessage());
        return resultVo;
    }
}
